<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<head>
    <%@ include file="/commons/global.jsp" %>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>花语花坊</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/base.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/normalize.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/cart.css"/>
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
</head>
<body>
<header>
    <a href="#">
        <img src="${pageContext.request.contextPath}/static/images/header.jpg" height="80"  width="100%" alt="" >
    </a>
</header>

<div class="shortcut">
    <div class="w">
        <ul class="fl city">
            <li><i class="f10"></i><a href="#">天津</a></li>
        </ul>
        <ul class="fr nav">
            <c:if test="${!empty member.member_name}">
                <li>
                    <a href="${pageContext.request.contextPath}/member/getuserdetail" style="display: inline">你好，${member.member_name}</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/member/getloglogin" style="display: inline">退出登录</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </li>
            </c:if>


            <%--<li>
                <a href="${pageContext.request.contextPath}/member/getlogin" style="display: inline">登录</a></li>
                <li class="space">
                </li>--%>
            <c:if test="${empty member.member_name}">
                <li class="space"></li>
                <li>
                    <a href="${pageContext.request.contextPath}/getlogin" style="display: inline">你好，请登录</a>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </li>
                <li>
                    <a href="${pageContext.request.contextPath}/getregister" class="f10"  style="display: inline">免费注册</a>
                </li>
                <li class="space"></li>
                <li>
                    <a href="${pageContext.request.contextPath}/member/getpay"  style="display: inline">我的订单</a>
                </li>
                <li class="space"></li>
            </c:if>

            <li class="space"></li>

            <li>
                <a href="#">客户服务</a>
                <i></i>
                <div class="dropdown-layer">
                    <dl class="d">
                        <dd><a href="#">待处理订单</a></dd>
                        <dd><a href="#">返修退换货</a></dd>
                        <dd><a href="#">降价商品</a></dd>
                    </dl>
                    <dl class="d">
                        <dd><a href="#">消息</a></dd>
                        <dd><a href="#">我的问答</a></dd>
                        <dd><a href="#">我的关注</a></dd>
                    </dl>
                    <dl>
                        <dd><a href="#">我的优惠券</a></dd>
                    </dl>
                </div>
            </li>

            <li class="space"></li>
            <li>
                <div>
                    <a>花语花坊鲜花网：非常棒的鲜花网品牌</a>
                </div>


            </li>

        </ul>
    </div>
</div>
<div class="m">
    <div class="w middle">
        <div class="logo">
            <h1>  <!-- 提高权重 便利于搜索引擎优化 -->
                <a href="${pageContext.request.contextPath}/member/getindex" title="花语花坊">花语花坊</a>
            </h1>
        </div>
        <form class="form" action="${pageContext.request.contextPath}/product/findproductListSelect" method="post">
            <input id="text" name="SelectName" type="text" placeholder="商品搜索">
            <button type="submit"><i></i></button>
        </form>
        <div class="shopCar">
            <i></i><a href="${pageContext.request.contextPath}/member/getcart">购物车</a><span>${countShopping}</span>
        </div>
        <div class="hotwords">
            <a href="#">红玫瑰</a>
            <a href="#">永生花</a>
            <a href="#">生日鲜花</a>
            <a href="#">礼品卡</a>
        </div>
        <div class="navitems">
            <ul>
                <li><a href="${pageContext.request.contextPath}/member/getindex">首页</a></li>
                <li><a href="${pageContext.request.contextPath}/product/getproducandproductimageList">鲜花</a></li>
                <li><a href="${pageContext.request.contextPath}/product/getproducandproductimageList">永生花</a></li>
                <li><a href="${pageContext.request.contextPath}/product/getproducandproductimageList">蛋糕</a></li>
                <li><a href="${pageContext.request.contextPath}/product/getproducandproductimageList">礼品</a></li>
                <li class="space "></li>
                <li><a href="${pageContext.request.contextPath}/product/getproducandproductimageList">巧克力</a></li>
                <li><a href="${pageContext.request.contextPath}/product/getproducandproductimageList">花语大全</a></li>
                <li><a href="${pageContext.request.contextPath}/product/getproducandproductimageList">企业团购</a></li>
                <li><a href="${pageContext.request.contextPath}/product/getproducandproductimageList">设计师甄选鲜花</a></li>
            </ul>
        </div>
    </div>
</div>
<div>
    <div class="w middle" style="height: 50px">
        <div class="navitems">
            <ul>
                <li class="tab_select">
                    <a
                        href="${pageContext.request.contextPath}/order?status=0">已付款
                    </a>
                </li>
                <li class="tab_select">
                    <a
                        href="${pageContext.request.contextPath}/order?status=3">未付款
                    </a>
                </li>
                <li class="tab_select">
                    <a
                        href="${pageContext.request.contextPath}/order?status=1">待收货
                    </a>
                </li>
                <li class="tab_select">
                    <a
                        href="${pageContext.request.contextPath}/order?status=2">已完成
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>

<div class="py-container">
    <div class="w">
        <div class="allgoods">
            <div class="cart-main">
                <div class="cart-th clearfix" style="width: 1250px">

                    <div class="">商品</div>
                    <div class="" style="margin-left: 420px;margin-right: 120px;">单价（元）</div>
                    <div class="">数量</div>
                    <div class="">实付款</div>
                    <div class="">交易状态</div>
                    <div class="">操作</div>


                </div>
                <div class="cart-item-list">
                    <div class="cart-body">
                        <div class="cart-list">

                            <c:forEach items="${orderFormList}" var="orderform" varStatus="i">
                                    <ul class="goods-list yui3-g"  style="background-color: #f4636a;margin:5px 0px">
                                        <li class="yui3-u-3-8 pr"data-id="${orderform.sell.product_id}">
                                            <div class="good-item">
                                                <div class="item-img">
                                                    <img src="${orderform.sell.product_image}" alt="">
                                                </div>
                                                <div class="item-msg">${orderform.sell.product_name}</div>
                                            </div>
                                        </li>
                                        <li class="yui3-u-1-8">
                                            <span class="price">${orderform.sell.sell_sum_price/orderform.sell.sell_amounts}</span>
                                        </li>
                                        <li class="yui3-u-1-8">
                                            <div class="clearfix">
                                                <input type="text" disabled="true" value="${orderform.sell.sell_amounts}" class="itxt" style="height: 34px;">
                                            </div>
                                        </li>
                                        <li class="yui3-u-1-8">
                                            <span class="sum">${orderform.sell.sell_sum_price}</span>
                                        </li>

                                        <li class="yui3-u-1-8">
                                            <div class="del1">
                                                <c:if test="${orderform.status==0}">
                                                    <a>待发货</a>
                                                </c:if>
                                                <c:if test="${orderform.status==1}">
                                                    <a>待收货</a>
                                                </c:if>
                                                <c:if test="${orderform.status==2}">
                                                    <a>已完成</a>
                                                </c:if>
                                                <c:if test="${orderform.status==3}">
                                                    <a>未付款</a>
                                                </c:if>

                                            </div>
                                        </li>
                                        <li class="yui3-u-1-8">
                                            <div class="del1">
                                                <c:if test="${orderform.status==0}">
                                                    <a href="javascript:;">已付款</a>
                                                </c:if>
                                                <c:if test="${orderform.status==1}">
                                                    <a href="javascript:;" onclick="showproduct(${orderform.order_code},${orderform.status})">确认收货</a>
                                                </c:if>
                                                <c:if test="${orderform.status==2}">
                                                    <a href="javascript:;">已完成</a>
                                                </c:if>
                                                <c:if test="${orderform.status==3}">
                                                    <a href="javascript:;" onclick="deleteproduct(${orderform.order_code})">删除订单</a>
                                                </c:if>

                                            </div>
                                        </li>

                                    </ul>

                            </c:forEach>

                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

<%@include file="/elements/index_bottom_a.html"%>
</body>
<script>
    var pathName=document.location.pathname;
    console.log("pathName="+pathName);
    var index=pathName.substr(1).indexOf("/");
    var result=pathName.substr(0,index+1);
    console.log(result);
    function showproduct(order_code,status) {
        $.ajax({
            type:"get",
            url:result+"/order/updateStatus",
            data:{order_code:order_code,status:2},
            dataType:"json",
            success:function (data) {
                if (data.success){
                    console.log("状态更新成功");
                    location.reload();
                }else {
                    console.log("状态更新失败");
                }
            }
        });
    }
    function deleteproduct(order_code) {
        $.ajax({
            type:"get",
            url:result+"/order/deleteOrderForm",
            data:{order_code:order_code},
            dataType:"json",
            success:function (data) {
                if (data.success){
                    console.log("删除未支付成功");
                    location.reload();
                }else {
                    console.log("删除未支付失败");
                }
            }
        });
    }
</script>


